﻿
<!DOCTYPE html>
<html lang="zh-cn" class="fullscreen-bg" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="common/links :: common_header(~{::title},~{},~{})">
    <title>-模块</title>
</head>
<body>
<!-- 页面加载loading -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                                        <label class="layui-form-label">用户名:</label>
                                        <div class="layui-input-inline">
                                            <input name="name" class="layui-input" placeholder="请输入用户名"/>
                                        </div>
                                    </div>
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">登录表id:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="loginId" class="layui-input" placeholder="请输入登录表id"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
                    <div class="layui-inline">
                                        <label class="layui-form-label">发布方式:</label>
                                        <div class="layui-input-inline">
                                            <select name="types" >
                                                <option value="">请选择</option>
                                                <option value="1">家长发布</option>
                                                <option value="2">老师发布</option>
                                            </select>
                                        </div>
                                    </div>
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">年龄:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="age" class="layui-input" placeholder="请输入年龄"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">手机号:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="phone" class="layui-input" placeholder="请输入手机号"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">微信:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="wx" class="layui-input" placeholder="请输入微信"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
                    <div class="layui-inline">
                                        <label class="layui-form-label">省:</label>
                                        <div class="layui-input-inline">
                                            <input name="province" class="layui-input" placeholder="请输入省"/>
                                        </div>
                                    </div>
                    <div class="layui-inline">
                                        <label class="layui-form-label">市:</label>
                                        <div class="layui-input-inline">
                                            <input name="city" class="layui-input" placeholder="请输入市"/>
                                        </div>
                                    </div>
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">县:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="county" class="layui-input" placeholder="请输入县"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">籍贯:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="place" class="layui-input" placeholder="请输入籍贯"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">就读学校:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="school" class="layui-input" placeholder="请输入就读学校"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">就读专业:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="major" class="layui-input" placeholder="请输入就读专业"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">现在身份:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="identity" class="layui-input" placeholder="请输入现在身份"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
                    <div class="layui-inline">
                                        <label class="layui-form-label">年级:</label>
                                        <div class="layui-input-inline">
                                            <input name="gradeId" class="layui-input" placeholder="请输入年级"/>
                                        </div>
                                    </div>
                    <div class="layui-inline">
                                        <label class="layui-form-label">科目:</label>
                                        <div class="layui-input-inline">
                                            <input name="subjectId" class="layui-input" placeholder="请输入科目"/>
                                        </div>
                                    </div>
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">上课区域:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="region" class="layui-input" placeholder="请输入上课区域"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">上课价格:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="money" class="layui-input" placeholder="请输入上课价格"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">上课时间:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="time" class="layui-input" placeholder="请输入上课时间"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">家长：是否有路程补助/教师：教师的努力:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="subsidy" class="layui-input" placeholder="请输入家长：是否有路程补助/教师：教师的努力"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">家长：孩子情况/教师：教授学科介绍:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="describe" class="layui-input" placeholder="请输入家长：孩子情况/教师：教授学科介绍"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">家长：对老师的要求/教师：相关经验:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="requirement" class="layui-input" placeholder="请输入家长：对老师的要求/教师：相关经验"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">是否保证信息真实:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="ensure" class="layui-input" placeholder="请输入是否保证信息真实"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">代理id:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="agentId" class="layui-input" placeholder="请输入代理id"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">状态:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input name="state" class="layui-input" placeholder="请输入状态"/>-->
<!--                                        </div>-->
<!--                                    </div>-->
                                                                                                                            <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="searchBtn" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>&nbsp;
                        <button shiro:hasPermission="users:export" id="exportBtn" class="layui-btn icon-btn" type="button">
                            <i class="layui-icon">&#xe67d;</i>导出
                        </button>
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="dataTable" lay-filter="dataTable"></table>
        </div>
    </div>
</div>

<!-- 表格操作列 -->
<script type="text/html" id="tableBar">
    <a shiro:hasPermission="users:update" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
    <a shiro:hasPermission="users:delete" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<!-- 表单弹窗 -->
<script type="text/html" id="formDialog">
    <form id="dataForm" lay-filter="dataForm" class="layui-form model-form">
                                    <input name="id" type="hidden"/>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">用户名:</label>
                            <div class="layui-input-block">
                                <input name="name" placeholder="请输入用户名" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">登录表:</label>
                            <div class="layui-input-block">
                                <input name="loginId" placeholder="请输入登录表id" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">性别:</label>
                            <div class="layui-input-block">
                                <input name="sex" placeholder="请输入性别" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">年龄:</label>
                            <div class="layui-input-block">
                                <input name="age" placeholder="请输入年龄" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">手机号:</label>
                            <div class="layui-input-block">
                                <input name="phone" placeholder="请输入手机号" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">微信:</label>
                            <div class="layui-input-block">
                                <input name="wx" placeholder="请输入微信" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">省:</label>
                            <div class="layui-input-block">
                                <input name="province" placeholder="请输入省" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">市:</label>
                            <div class="layui-input-block">
                                <input name="city" placeholder="请输入市" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">县:</label>
                            <div class="layui-input-block">
                                <input name="county" placeholder="请输入县" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">籍贯:</label>
                            <div class="layui-input-block">
                                <input name="place" placeholder="请输入籍贯" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">就读学校:</label>
                            <div class="layui-input-block">
                                <input name="school" placeholder="请输入就读学校" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">就读专业:</label>
                            <div class="layui-input-block">
                                <input name="major" placeholder="请输入就读专业" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
                                                                                                                                <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">现在身份:</label>
                            <div class="layui-input-block">
                                <input name="identity" placeholder="请输入现在身份" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">年级:</label>
                            <div class="layui-input-block">
                                <input name="gradeId" placeholder="请输入年级id" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">科目:</label>
                            <div class="layui-input-block">
                                <input name="subjectId" placeholder="请输入科目id" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">上课区域:</label>
                            <div class="layui-input-block">
                                <input name="region" placeholder="请输入上课区域" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">上课价格:</label>
                            <div class="layui-input-block">
                                <input name="money" placeholder="请输入上课价格" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">上课时间:</label>
                            <div class="layui-input-block">
                                <input name="time" placeholder="请输入上课时间" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">家长：是否有路程补助/教师：教师的努力:</label>
                            <div class="layui-input-block">
                                <input name="subsidy" placeholder="请输入家长：是否有路程补助/教师：教师的努力" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">家长：孩子情况/教师：教授学科介绍:</label>
                            <div class="layui-input-block">
                                <input name="describe" placeholder="请输入家长：孩子情况/教师：教授学科介绍" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">家长：对老师的要求/教师：相关经验:</label>
                            <div class="layui-input-block">
                                <input name="requirement" placeholder="请输入家长：对老师的要求/教师：相关经验" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
        <div class="layui-form-item">
                            <label class="layui-form-label layui-form-required">是否保证信息真实:</label>
                            <div class="layui-input-block">
                                <input name="ensure" placeholder="请输入是否保证信息真实" class="layui-input"
                                       lay-verType="tips" lay-verify="required" required/>
                            </div>
                        </div>
<!--        <div class="layui-form-item">-->
<!--                            <label class="layui-form-label layui-form-required">代理:</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input name="agentId" placeholder="请输入代理id" class="layui-input"-->
<!--                                       lay-verType="tips" lay-verify="required" required/>-->
<!--                            </div>-->
<!--                        </div>-->
<!--        <div class="layui-form-item">-->
<!--                        <label class="layui-form-label layui-form-required">创建时间:</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <input id="carDate" name="carDate" placeholder="请选择创建时间"-->
<!--                                   class="layui-input icon-date" autocomplete="off" lay-verType="tips"-->
<!--                                   lay-verify="required" required/>-->
<!--                        </div>-->
<!--                    </div>-->
<!--        <div class="layui-form-item">-->
<!--                        <label class="layui-form-label layui-form-required">修改时间:</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <input id="uptDate" name="uptDate" placeholder="请选择修改时间"-->
<!--                                   class="layui-input icon-date" autocomplete="off" lay-verType="tips"-->
<!--                                   lay-verify="required" required/>-->
<!--                        </div>-->
<!--                    </div>-->
<!--        <div class="layui-form-item">-->
<!--                            <label class="layui-form-label layui-form-required">状态:</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input name="state" placeholder="请输入状态" class="layui-input"-->
<!--                                       lay-verType="tips" lay-verify="required" required/>-->
<!--                            </div>-->
                        </div>

        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="saveBtn" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>
<!-- js部分 -->
<div th:replace="common/scripts :: common"></div>
<div th:replace="common/scripts :: custom"></div>
<div>
    <script>
        //全局变量 Shiro权限
        var shiroSave = false;
        var shiroDelete = false;
        var shiroUpdate = false;
        var shiroInfo = false;
    </script>
    <!-- 设置Shiro权限变量 -->
    <shiro:hasAllPermissions name="users:save">
        <script>shiroSave = true;</script>
    </shiro:hasAllPermissions>
    <shiro:hasAllPermissions name="users:delete">
        <script>shiroDelete = true;</script>
    </shiro:hasAllPermissions>
    <shiro:hasAllPermissions name="users:update">
        <script>shiroUpdate = true;</script>
    </shiro:hasAllPermissions>
</div>
<script>
    layui.use(['layer', 'form', 'table', 'util', 'laydate', 'tableX','admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var laydate = layui.laydate;
        var tableX = layui.tableX;
        var admin = layui.admin;

        /* 渲染表格 */
        var cols = [
            {type: 'checkbox'},
            {field: 'uid', title: '用户编号',align: 'center'},
            {field: 'names', title: '用户名',align: 'center'},
            {field: 'types', title: '发布方式',align: 'center',templet:function (d) {
                    var s=["家长发布","老师发布"];
                    return s[d.types-1];
                }},
            //{field: 'loginId', title: '登录表id',align: 'center'},
            {field: 'sex', title: '性别',align: 'center'},
            {field: 'age', title: '年龄',align: 'center'},
            {field: 'phone', title: '手机号',align: 'center'},
            {field: 'wx', title: '微信',align: 'center'},
            {field: 'province', title: '省',align: 'center'},
            {field: 'city', title: '市',align: 'center'},
            {field: 'county', title: '县',align: 'center'},
            {field: 'place', title: '籍贯',align: 'center'},
            {field: 'classCount', title: '上课次数',align: 'center'},
            {field: 'classPlace', title: '上课地址',align: 'center'},
            {field: 'school', title: '就读学校',align: 'center'},
            {field: 'major', title: '就读专业',align: 'center'},
            {field: 'identity', title: '现在身份',align: 'center'},
            {field: 'grade.name', title: '年级',align: 'center',templet:function (d) {
                    var s=["幼儿","小学","初中","高中","大学","考研","考博","成人","出国"];
                    return s[d.types-1];
                }},
            {field: 'subject.name', title: '科目',align: 'center',templet:function (d) {
                    var s=["数学","语文","外语","历史","化学","生物","政治","地理","物理","中考","高考","信息科技","雅思","托福","英语口语","钢琴","吉他","其他艺术"];
                    return s[d.types-1];
                }},
            {field: 'region', title: '上课区域',align: 'center'},
            {field: 'money', title: '上课价格',align: 'center'},
            {field: 'times', title: '上课时间',align: 'center'},
            {field: 'subsidy', title: '家长：是否有路程补助/教师：教师的努力',align: 'center'},
            {field: 'describe', title: '家长：孩子情况/教师：教授学科介绍',align: 'center'},
            {field: 'requirement', title: '家长：对老师的要求/教师：相关经验',align: 'center'},
            {field: 'ensure', title: '是否保证信息真实',align: 'center'},
            //{field: 'agentId', title: '代理id',align: 'center'},
            //{field: 'state', title: '状态',align: 'center'},
            {title: '操作', toolbar: '#tableBar', align: 'center', minWidth: 200}
        ];

        var insTb = table.render({
            elem: '#dataTable',
            url: 'users/page',
            page: true,
            toolbar: [shiroToolbar(shiroSave,shiroDelete)].join(''),
            cellMinWidth: 100,
            cols: [cols],
            done: function () {
                // 绑定鼠标右键
                tableX.bindCtxMenu('dataTable', shiroBindCtxMenu(shiroDelete,shiroUpdate));
            }
        });

        /* 表格工具条点击事件 */
        table.on('tool(dataTable)', function (obj) {
            if (obj.event === 'edit') { // 修改
                showEditModel(obj.data);
            } else if (obj.event === 'del') { // 删除
                doDel(obj.data);
            } else if (obj.event === 'reset') { // 重置密码
                resetPsw(obj);
            }
        });

        /* 表格头工具栏点击事件 */
        table.on('toolbar(dataTable)', function (obj) {
            if (obj.event === 'add') { // 添加
                showEditModel();
            } else if (obj.event === 'del') { // 删除
                var checkRows = table.checkStatus('dataTable');
                if (checkRows.data.length === 0) {
                    layer.msg('请选择要删除的数据', {icon: 2});
                    return;
                }
                var ids = checkRows.data.map(function (d) {
                    return d.id;
                });
                doDel({ids: ids});
            }
        });

        // 显示编辑弹窗
        function showEditModel(mData) {
            admin.open({
                type: 1,
                area: '800px',
                title: (mData ? '修改' : '添加'),
                content: $('#formDialog').html(),
                shadeClose:true,
                success: function (layero, dIndex) {
                    form.val('dataForm', mData);  // 回显数据
                    form.on('submit(saveBtn)', function (data) {
                        $.post(mData?'users/update':'users/save', data.field, function (res) {
                            if (res.code == 0) {
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                insTb.reload({page: {curr: 1}});
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }, 'json');
                        return false;
                    });
                }
            });

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                /* 渲染laydate */
                        laydate.render({
                            elem: '#carDate',
                        });
                                                                                                            /* 渲染laydate */
                        laydate.render({
                            elem: '#uptDate',
                        });
                                                                                                                                            }

        /* 表格搜索 */
        form.on('submit(searchBtn)', function (data) {
            if (data.field.dateRange) {
                var searchDate = data.field.dateRange.split(' - ');
                data.field.startDate = searchDate[0];
                data.field.endDate = searchDate[1];
            } else {
                data.field.startDate = '';
                data.field.endDate = '';
            }
            data.field.dateRange = undefined;
            insTb.reload({where: data.field, page: {curr: 1}});
            return false;
        });

        /* 导出excel */
        $('#exportBtn').click(function () {
            var checkRows = table.checkStatus('dataTable');
            if (checkRows.data.length === 0) {
                layer.msg('请选择要导出的数据', {icon: 2});
            } else {
                tableX.exportDataX({
                    cols: insTb.config.cols,
                    data: checkRows.data,
                    fileName: '导出数据'
                });
            }
        });


        /* 删除 */
        window.doDel = function(obj){
            layer.confirm('确定要删除选中数据吗？', {
                skin: 'layui-layer-admin',
                shade: .1
            }, function (i) {
                layer.close(i);
                var loadIndex = layer.load(2);
                $.post('users/delete', {
                    id: obj ? obj.id : '',
                    ids: obj.ids ? obj.ids.join(',') : ''
                }, function (res) {
                    layer.close(loadIndex);
                    if (res.code === 0) {
                        layer.msg(res.msg, {icon: 1});
                        insTb.reload({page: {curr: 1}});
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }, 'json');
            });
        }

        /* 渲染时间选择 */
        laydate.render({
            elem: 'input[name="dateRange"]',
            type: 'date',
            range: true,
            trigger: 'click'
        });
    });
</script>
</body>
</html>